import http from "../request";
const apibase = "/api/JobFieldDataScript";

//获取结果脚本
var getJobFieldDataScripts = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/GetJobFieldDataScripts`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//批量新增脚本
var addJobFieldDataScripts = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/AddJobFieldDataScripts`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//批量修改脚本
var updateJobFieldDataScripts = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/UpdateJobFieldDataScripts`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//删除脚本
var deleteJobFieldDataScript = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/DeleteJobFieldDataScript`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

export {
  deleteJobFieldDataScript,
  updateJobFieldDataScripts,
  addJobFieldDataScripts,
  getJobFieldDataScripts,
};
